<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script src="https://minglie.gitee.io/mingpage/static/public/jquery/1.11.3/jquery-1.11.3.js"></script>
</head>
<body>

    <script>
        function myJsonp(url, callbackFunction){
            weatherNowInfo=(d)=>{
                callbackFunction(d);
                document.body.removeChild(document.getElementById("JsonPId"))
            }
            var scriptElement = document.createElement('script');
            scriptElement.src = url;
            scriptElement.id="JsonPId"
            document.body.appendChild(scriptElement);
        };
   </script>

<button id="btn1">get1</button>
<button id="btn2">postJson</button>


<script>

base="http://server.com"
btn1.onclick = function get1() {
    // base="http://query.asilu.com"
    
    myJsonp(`${base}/weather/now/?callback=weatherNowInfo&lng=120.13026lat=30.25961&_=1604745448693`,(d)=>{
        console.log(d)

     

    })
}



btn2.onclick = function get2() {

    // $.getJSON(`${base}//weather/now`).then(function (result) {
	// 			console.log(result);
	// 			btn1.innerHTML = JSON.stringify(result)
    // 		});
    


    $.ajax({
					url:`${base}/weather/now`,
					dataType: "jsonp",
					jsonp: "callback",
					cache:true,
					success: function(json){
                        result = json;
                        console.log(result)
					}})
}



		
</script>





    
</body>
</html>